package util;

import javax.swing.text.AttributeSet;  
import javax.swing.text.BadLocationException;  
import javax.swing.text.PlainDocument; 

public class DocumentoCaixaAlta extends PlainDocument{
	/**
	 * 
	 */
	private static final long serialVersionUID = -3435582140263298029L;
	private int maximo;

	public DocumentoCaixaAlta(int qtMaxCaracteres){
		maximo = qtMaxCaracteres;
	}

	public void insertString(int offs, String str, AttributeSet a) throws BadLocationException{
		if((getLength() + str.length()) <= maximo)
			super.insertString(offs, str.toUpperCase(), a);
	}
}
